<template>
  <div class="uploadList">
    <el-table :data="tableList" stripe border class="user-table" :height="tableHeight" style="width: 100%;" v-loading="loading">
      <el-table-column fixed type="index" label="序号" sortable min-width="30"></el-table-column>
      <el-table-column prop="planTaskTotal.taskNo" label="任务单号" sortable width="100"></el-table-column>
      <el-table-column prop="planTaskTotal.code29" label="29所编码" sortable width="100"></el-table-column>
      <el-table-column prop="planTaskTotal.taskSerialNo" label="任务流水号" sortable width="100"></el-table-column>
      <!-- <el-table-column prop="planTaskTotal.customerName.name" label="客户" sortable width="100" > </el-table-column>
      <el-table-column prop="planTaskTotal.planAttribute" label="计划属性" sortable width="100"></el-table-column>
      <el-table-column prop="planTaskTotal.priority" label="优先级" sortable min-width="100" > </el-table-column> -->
      <!-- <el-table-column prop="issueDate" label="计划下发时间" sortable width="100" :formatter="timeFormatter" ></el-table-column> -->
      <el-table-column prop="planTaskTotal.wbPlanFinsihDate" label="外包计划完成时间" sortable width="100" :formatter="timeFormatter"></el-table-column>
      <el-table-column prop="planTaskTotal.nums" label="件数" sortable width="60"></el-table-column>
      <el-table-column prop="planTaskTotal.makeNo" label="生产令号" sortable min-width="200"></el-table-column>
      <el-table-column prop="planTaskTotal.drawNo" label="图纸序号" sortable min-width="50"></el-table-column>
      <el-table-column prop="planTaskTotal.drawName" label="图纸名称" sortable min-width="120"></el-table-column>
      <el-table-column prop="planTaskTotal.drawNums" label="项目图纸张数"  width="50"  align="center"></el-table-column>
      <el-table-column prop="planTaskTotal.drawCode" label="图纸编号" sortable min-width="120"></el-table-column>
      <el-table-column prop="wxTime" label="外协时间" sortable min-width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.wxTime!=null">
            {{timestampToTime(scope.row.wxTime,'yyyy-mm-dd')}}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="wxUserName" label="外协人员" sortable min-width="120"></el-table-column>
      <el-table-column prop="planDeliveryDate" label="计划交货日期" sortable min-width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.planDeliveryDate!=null">
            {{timestampToTime(scope.row.planDeliveryDate,'yyyy-mm-dd')}}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="realDeliveryDate" label="实际交货日期" sortable min-width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.realDeliveryDate!=null">
            {{timestampToTime(scope.row.realDeliveryDate,'yyyy-mm-dd')}}
          </span>
        </template>        
      </el-table-column>
      <el-table-column prop="wxProducer" label="外协厂家" sortable min-width="120"></el-table-column>
      <el-table-column prop="qualifiedNums" label="合格数量" sortable min-width="120"></el-table-column>
      <el-table-column prop="unqualifiedNums" label="不合格数量" sortable min-width="120"></el-table-column>
      <el-table-column prop="createUserName" label="外协创建人" sortable min-width="120"></el-table-column>
      <el-table-column prop="createTime" label="创建时间" sortable min-width="180">
        <template slot-scope="scope">
          <span v-if="scope.row.createTime!=null">
            {{timestampToTime(scope.row.createTime,'yyyy-mm-dd')}}
          </span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="importerName" label="导入人" sortable width="100"></el-table-column>
      <el-table-column prop="importDate" label="导入时间" sortable min-width="100" :formatter="timeFormatter"></el-table-column> -->
      <el-table-column fixed="right" label="操作" align="right" min-width="120">
        <template slot-scope="scope">
          <slot  :row="scope.row"></slot>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
  </div>
</template>
<script>
import planApi from 'plugins/axios/planApi.js';
export default {
  name: 'tableListOtherTask',
  props:{
    postData:{
      type:Object
    }
  },
  data (){
    return {
      loading:false,
      tableList:[],
      pagination:{/**分页参数 */
        currentPage:1,
        pageSize:10,
        total:0
      },
    }
  },
  watch:{

  },
  created(){},
  computed:{
    tableHeight(){
      return this.$store.state.clientHeight-184;
    }
  },
  methods:{
    /**时间格式化 */
    timeFormatter(row, column, cellValue, index){
      return cellValue?this.timestampToTime(cellValue,'yyyy-mm-dd'):'';
    },
    get29TableList(){
      let self = this;
      self.loading = true;
      debugger;
      let obj = {
            currentPage:self.postData.isSearchButton==true?1:self.pagination.currentPage,
            pageSize:self.pagination.pageSize,
            startWxTime:self.postData.startWxTime, //外协时间（开始）
            endWxTime:self.postData.endWxTime,   //外协时间（结束）
            wxUser:self.postData.wxUser, //外协人员
            wxProducer:self.postData.wxProducer, //外协厂家
            startPlanDeliveryDate:self.postData.startPlanDeliveryDate, //计划交货日期（开始）
            endPlanDeliveryDate:self.postData.endPlanDeliveryDate, //计划交货日期（结束）
            startRealDeliveryDate:self.postData.startRealDeliveryDate, //实际交货日期（开始）
            endRealDeliveryDate:self.postData.endRealDeliveryDate, //实际交货日期（结束）
            customer:self.postData.customer, //客户

            taskNo:self.postData.taskNo, //任务单号
            taskSerialNo:self.postData.taskSerialNo, //流水号
            makeNo:self.postData.makeNo, //生产令号
            startWbPlanFinsihDate:self.postData.startWbPlanFinsihDate, //外包完成时间（开始）
            endWbPlanFinsihDate:self.postData.endWbPlanFinsihDate, //外包完成时间（结束）
            drawCode:self.postData.drawCode, //图纸编号
            drawName:self.postData.drawName, //图纸名称
            status:self.postData.status,//状态：待办0，已办1


      }
      planApi.selectMpWxByCondition(obj).then(res=>{
        self.loading = false;
        self.tableList= res.content.records;
        self.pagination.total =res.content.total;
      },error=>{
        self.loading = false;
      })
    },
    handleSizeChange(size){/**切换分页条数 */
      this.pagination.pageSize=size;
      this.pagination.currentPage=1;
      this.get29TableList();
    },
    handleCurrentChange(current){/**切换分页页数 */
      this.pagination.currentPage=current;
      this.postData.isSearchButton = false;
      this.get29TableList();
    }
  }
}
</script>
<style lang="stylus" scoped>

</style>